<?php

namespace application\Module;

use library\Core\Db\CDbCriteria;
use application\Model\HelpModel;
use application\Comm\Request;

class Help
{

    /**
     * @param $pid
     * @param array $select
     * @return array
     * 根据位置获取帮助文章
     */
    public function getList($pid, $select = ['id', 'name', 'description', 'url'])
    {
        $criteria = new CDbCriteria();
        $criteria->select($select);
        $criteria->addEqCondition('category_id', $pid);
        $criteria->addEqCondition('is_del', 0);
        $criteria->addEqCondition('status', 1);
        $criteria->addOrderDesc('orderby');
        $adtextModel = new HelpModel();
        return $data = $adtextModel->getListForArray($criteria);
    }

    /**
     * @param $pid
     * @param array $select
     * @return array
     * 根据位置获取帮助文章
     */
    public function getListAll($select = ['id', 'name', 'description', 'url'])
    {
        $criteria = new CDbCriteria();
        $criteria->select($select);
        $criteria->addEqCondition('is_del', 0);
        $criteria->addEqCondition('status', 1);
        $criteria->addOrderDesc('orderby');
        $adtextModel = new HelpModel();
        return $data = $adtextModel->getListForArray($criteria);
    }

}
